#ifndef UTIL_H
#define UTIL_H

#include <string>
using std::string;

static string nullStr = "";

static inline int max(const string &a, const string &b)
{
    if(a.length() > b.length())
        return a.length();
    return b.length();
}

static inline int min(int a, int b)
{
    if(a < b)
        return a;
    return b;
}

int parseCarg(int argc, char *argv[],
              string& run_mode, string& cmd, string& set_value, string& address = nullStr);

#define MAX_32BIT_INT 0xffff

bool isStringStartsWith(const std::string&str, const std::string&suffix, int start = 0, int end = MAX_32BIT_INT);
bool isStringEndsWith(const std::string&str, const std::string&suffix, int start = 0, int end = MAX_32BIT_INT);
#endif /* ifndef UTIL_H */
